# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Jonathan Liu <net147@gmail.com>

_realname=opus-tools

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.1.8
pkgrel=2
pkgdesc="Collection of tools for Opus audio codec (mingw-w64)"
arch=('any')
url="http://www.opus-codec.org/"
license=("BSD")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" "${MINGW_PACKAGE_PREFIX}-flac" "${MINGW_PACKAGE_PREFIX}-libogg" "${MINGW_PACKAGE_PREFIX}-opus")
options=('strip' 'staticlibs')
source=(http://downloads.xiph.org/releases/opus/$_realname-$pkgver.tar.gz)
md5sums=('b424790eda9357a4df394e2d7ca19eac')

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST}
  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install

  # Install license
  #install -Dm644 ${srcdir}/${_realname}-${pkgver}/COPYING ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE
}
